import easygui, random

end_page = 'play again' #will be 'quit' when we decide to stop
while end_page =='play again': #lets you play again when you click 'play again' by putting the entire programme underneath it in a loop
   no_dice = easygui.integerbox("How many dice do you want?") #no_dice = number of dice variable

   good_dice = False #We don't want 1-sided dice, so will keep  asking until a big enough integer is put in
   while good_dice == False:
       no_sides = easygui.integerbox("How many sides do you want on each of the "+str(no_dice)+" dice that you've got? PS. please don't put anything ridiculous, 'cause it will take me ages")
       if no_sides > 1:
           good_dice = True
       if no_sides == 1:
           easygui.msgbox("You can't have one-sided dice!")

   total_bank = 0 #total_bank stores the running total

   for looper in range(1, no_dice+1): #roll dice one after another in a loop. +1 is because the computer doesn't cout the last number in the loop.
       roll_die = random.randint(1, no_sides) #random integer from 1 to no_sides inclusive
#        print roll_die   #if you want, remove the first hash on this line an the computer will print what it rolled on each die
       total_bank = total_bank + roll_die #add number rolled on die to the total

   end_page = easygui.buttonbox ("Your total of all the "+str(no_dice)+", "+str(no_sides)+"-sided dice that you rolled is " +str(total_bank)+ ". Congratulations! You just played the purvis python dice rolling game. I beat your score but, if it's any consolation, you beat my dad.", choices = ['quit', 'play again']) #give result and play again/ quit choice